package com.njupt.wuaiagent.demo.invoke;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.advisor.api.Advisor;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Author: wujiaming
 * @CreateTime: 2025/5/10 15:55
 * @Description: SpringAI框架调用大模型
 * @Version: 1.0
 */


//@Component
public class SpringAiInvoke implements CommandLineRunner {

    @Resource
    private ChatModel dashscopeChatModel;




    @Override
    public void run(String... args) throws Exception {
        AssistantMessage outPut = dashscopeChatModel.call(new Prompt("你好,我是鱼皮"))
                .getResult()
                .getOutput();
        System.out.println(outPut.getText());
    }
}
